#include "defs.h"
#include "garmin_tables.h"
#include "jeeps/gpsmath.h"
-#include "strptime.h"
#define MYNAME "exif"
static time_t
exif_get_exif_time(exif_app_t* app)
{
+ QDateTime res;
+
exif_tag_t* tag;
- time_t res = 0;
tag = exif_find_tag(app, EXIF_IFD, 0x9003); /* DateTimeOriginal from EXIF */
if (! tag) {
if (! tag) {
tag = exif_find_tag(app, EXIF_IFD, 0x9004); /* DateTimeDigitized from EXIF */
}
+
if (tag) {
- struct tm tm;
- char* c, *str;
+ char* str;
- memset(&tm, 0, sizeof(tm));
str = exif_read_str(tag);
- c = strptime(str, "%Y:%m:%d %H:%M:%S", &tm);
- if (c && (*c == '\0')) {
- res = mklocaltime(&tm);
- }
-
+ res = QDateTime::fromString(str, "yyyy:MM:dd hh:mm:ss");
xfree(str);
}
- return res;
+ return res.toTime_t();
}
static waypoint*
} else {
timestamp = datestamp;
}
+
if (timestamp != UNKNOWN_TIMESTAMP) {
#ifdef EXIF_DBG
char* str = exif_time_str(timestamp);
static void
html_disp(const waypoint* wpt)
{
- char tbuf[1024];
char* cout;
- time_t tm = wpt->GetCreationTime().toTime_t();
int32_t utmz;
double utme, utmn;
char utmzc;
GPS_Math_WGS84_To_UTM_EN(wpt->latitude, wpt->longitude,
&utme, &utmn, &utmz, &utmzc);
- if (tm == 0) {
- tm = time(NULL);
- }
- strftime(tbuf, sizeof(tbuf), "%d-%b-%Y", localtime(&tm));
-
-
gbfprintf(file_out, "\n<a name=\"%s\"><hr></a>\n", wpt->shortname);
gbfprintf(file_out, "<table width=\"100%%\">\n");
gbfprintf(file_out, "<tr><td><p class=\"gpsbabelwaypoint\">%s - ",(global_opts.synthesize_shortnames) ? mkshort_from_wpt(mkshort_handle, wpt) : wpt->shortname);
void kml_write(void)
{
- char import_time[100];
- time_t now;
const global_trait* traits = get_traits();
// Parse options
writer->writeStartElement("Document");
- now = current_time().toTime_t();
- strftime(import_time, sizeof(import_time), "%c", localtime(&now));
if (realtime_positioning) {
writer->writeTextElement("name", "GPS position");
} else {
writer->writeTextElement("name", "GPS device");
}
- if (now) {
- writer->writeTextElement("snippet", QString("Created ") + QString(import_time));
+ if (current_time().isValid()) {
+ writer->writeTextElement("snippet", QString("Created ") +
+ current_time().toString());
}
kml_write_AbstractView();
#include <time.h>
#include "defs.h"
-#include "strptime.h"
#define MYNAME "skyforce"
skyforce_parse_trk(const char* str)
{
char* cx;
- struct tm tm;
char buf[15];
int len;
if (wpt == NULL) {
return NULL;
}
-
- memset(&tm, 0, sizeof(tm));
strncpy(buf, str + 2, sizeof(buf) - 1);
buf[14] = 0;
- cx = strptime(buf, "%d%m%y %H%M%S ", &tm);
- if ((cx != NULL) && (*cx != '\0')) {
- fatal(MYNAME ": Could not parse date string (%s - %s).\n", buf, cx);
- }
-
- wpt->SetCreationTime(mkgmtime(&tm));
+ QDateTime dt = QDateTime::fromString(buf, "ddMMyy hhmmss");
+ dt.setTimeSpec(Qt::UTC);
+ dt = dt.addYears(100);
+ wpt->SetCreationTime(dt);
len = strlen(str);
if (len >= 45) {
text_disp(const waypoint* wpt)
{
int latint, lonint;
- char tbuf[1024];
- time_t tm = wpt->GetCreationTime().toTime_t();
+// char tbuf[1024];
+// time_t tm = wpt->GetCreationTime().toTime_t();
int32_t utmz;
double utme, utmn;
char utmzc;
GPS_Math_WGS84_To_UTM_EN(wpt->latitude, wpt->longitude,
&utme, &utmn, &utmz, &utmzc);
-
+#if 0
if (tm == 0) {
tm = time(NULL);
}
strftime(tbuf, sizeof(tbuf), "%d-%b-%Y", localtime(&tm));
-
+#endif
tmpout1 = pretty_deg_format(wpt->latitude, wpt->longitude, degformat[2], " ", 0);
if (wpt->altitude != unknown_alt) {
xasprintf(&altout, " alt:%d", (int)((altunits[0]=='f')?METERS_TO_FEET(wpt->altitude):wpt->altitude));